package com.tjetc.dao;

import com.tjetc.entity.Folder;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Delete;

import java.util.List;
import java.util.Map;

public interface FavouriteMapper {

    // 插入默认收藏夹
    int insertDefaultFolders(@Param("userId") Long userId);

    // 插入新收藏夹

    int insertFolder(@Param("userId") Long userId, @Param("name") String name);

    @Options(useGeneratedKeys = true, keyProperty = "favouriteId", keyColumn = "favourite_id")
    Long insertFavourite(Map<String, Object> param);

    // 删除收藏夹
    int deleteFolder(@Param("folderId") Long folderId);

    // 根据收藏夹 ID 删除对应的收藏项

    int deleteFavoritesByFolderId(@Param("folderId") Long folderId);

    // 删除指定的收藏项
    int removeFavorite(@Param("folderId") Long folderId,
                       @Param("type") Long type,
                       @Param("bindId") Long bindId);

    // 查找指定的收藏项
    int findSpotfavourite(@Param("userId") Long userId,
                          @Param("bindId") Long bindId,
                          @Param("type") Long type);

    Long findDefaultfolder(Long userId);

    List<Folder> findUserFavourite(@Param("folderId")Long folderId, @Param("name")String name, @Param("userId")Long userId);

    Map<String, Object> findContentData(@Param("tableName") String tableName,
                                        @Param("idColumn") String idColumn,
                                        @Param("bindId") Long bindId);

    int updateFavourite(Long favouriteId, String title, String description, String imagePath);

    Long findFolder(Long userId, Long type, Long bindId);
}
